import { Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';


@Entity('t_area_weather')
export class WeatherInfo {

  @PrimaryGeneratedColumn({ unsigned: true, type: 'int' })
  id: number;

  @Index('idx_area_id', { unique: false })
  @Column({ unsigned: true, type: 'int', name: 'area_id', comment: '区域ID', nullable: false })
  areaId: number;

  @Column({ type: 'date', nullable: true, comment: '日期 YYYY-MM-DD' })
  date: Date;

  @Column({ type: 'tinyint', comment: '温度', nullable: false })
  temperature: number;

  @Column({ type: 'varchar', comment: '天气描述', nullable: false })
  desc: string;

  @Column({ type: 'int', unsigned: true, comment: '空气质量指数', nullable: false })
  aqi: number;

  @Column({ type: 'tinyint', unsigned: true, comment: '降水概率', nullable: false })
  precipitation: number;

  @CreateDateColumn({ name: 'created_at' })
  createdAt: Date;

  @UpdateDateColumn({ name: 'updated_at' })
  updatedAt: Date;

}
